home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / Epic4_mos / share / epic / help / 5_programming / wait < prev    next >
Encoding:
Text File  |  2002-10-28  |  2.3 KB  |  65 lines

  1. Synopsis:
  2.    wait [for] [%<process>]|[-cmd <command>]
  3.  
  4. Description:
  5.    WAIT is a convenient means for executing a series of commands and
  6.    ensuring that those commands are run in the desired sequence.  The
  7.    command can make the client wait for the completion of server or
  8.    subprocess output.
  9.  
  10.    The simplest form is WAIT with no arguments.  When run after a server
  11.    query, the client will not execute further commands (within an alias;
  12.    does not apply to the input line) until all server output has been
  13.    received.
  14.    
  15.    If used as /wait for, it will execute the command, and halt until a server
  16.    reply is detected.
  17.  
  18.    When waiting on an EXECed subprocess, the client will block until the
  19.    subprocess has completed.  This effectively disables the the entire
  20.    client (and can even cause it to ping timeout from the server).
  21.  
  22.    The last form allows for a series of commands to be executed in no
  23.    particular order.  This is most useful when a particular command needs
  24.    to be issued, but subsequent commands don't rely on its contents or
  25.    timing.
  26.  
  27. Options:
  28.    -cmd <commands>   execute the given commands at the end of the alias
  29.  
  30. Examples:
  31.    To add a header and footer to a channel's ban list:
  32.       alias banlist {
  33.          echo *** Begin ban list for #blah (generated $stime($time()))
  34.          mode #blah +b
  35.          wait
  36.          echo *** End ban list for #blah
  37.       }
  38.  
  39.    To run a subprocess, and wait before doing anything else:
  40.       alias localusers {
  41.          echo *** Getting list of local users...
  42.          exec -name who who
  43.          wait %who
  44.          echo *** Finished subshell `who' listing
  45.       }
  46.  
  47.    The second command will actually finish before the first:
  48.       alias backwards {
  49.          wait -cmd echo this appears last
  50.          echo this appears first
  51.       }
  52.  
  53. Other Notes:
  54.    If multiple WAITs are pending at once, they will all return once the last
  55.    one is completed, to ensure that no data is lost.
  56.  
  57.    Using WAIT for server queries is useful.  However, there are often times
  58.    then it is not the most efficient way to do something.  When possible,
  59.    hooking server numerics that marks the end of a message is preferred, as
  60.    it is generally more reliable.
  61.  
  62.    Using wait(5) or wait(5) for and /redirect is a Bad Thing(tm), so
  63.    don't do it.
  64.  
  65.